import 'package:elephant_fish/model/rank_year_entity.dart';
import 'package:elephant_fish/util/size_util.dart';
import 'package:elephant_fish/widget/charm_year_rank_list.dart';
import 'package:flutter/cupertino.dart';

import 'charm_rank_list.dart';

class RankYearCardList extends StatefulWidget {
  final RankYearEntity rankYearEntity;
  const RankYearCardList({Key key, this.rankYearEntity}) : super(key: key);

  @override
  _RankYearCardListState createState() => _RankYearCardListState();
}

class _RankYearCardListState extends State<RankYearCardList> {
  Arr arr;
  ScrollController _scrollController = ScrollController();

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        widget.rankYearEntity.arr != null
            ? Container(
          width: 345,
          height: 50,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(SizeUtil.px(18)),
                topRight: Radius.circular(SizeUtil.px(18))),
            gradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [Color(0xfffe4d4e), Color(0xffff2d8f)],
            ),
          ),
          child: Center(
              child: Text(
                widget.rankYearEntity.giftName + '榜',
                style: TextStyle(
                  color: Color(0xffffffff),
                ),
              )),
        )
            : Text(
          '',
          style: TextStyle(
            color: Color(0xffffffff),
          ),
        ),
        Container(
          width: 345,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(SizeUtil.px(18)),
                bottomRight: Radius.circular(SizeUtil.px(18))),
            gradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [Color(0xff221641), Color(0xff661e38)],
            ),
          ),
          child: ListView.builder(
              itemCount: 1,
              controller: _scrollController,
              shrinkWrap: true,
              itemBuilder: (context, index) {
                return CharmYearRankList(anchor: widget.rankYearEntity.arr,);
              }),
        )
      ],
    );
  }

}
